/**
 * This file is part of Lineage II Client Data Parser.
 * 
 * Lineage II Client Data Parser is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.

 * Lineage II Client Data Parser is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with Lineage II Client Data Parser.  If not, see <http://www.gnu.org/licenses/>.
 */
package net.l2emuproject.entity;

/**
 * @author Savormix
 *
 */
public final class MonsterSkill extends MonsterSkillPassive
{
	private final String	seqName;
	private final String	skillName;
	private final String	npcName;
	private final String	npcClass;
	// Deterministic
	private int				skillLevel	= 1;

	// Experimental

	/**
	 * Creates a monster skill entry containing base data
	 * @param npcID Monster ID
	 * @param skillID Skill ID
	 * @param seqName Skill sequence name
	 * @param skillName Skill name
	 * @param npcName Monster name
	 * @param npcClass Monster NPC class
	 */
	public MonsterSkill(int npcID, int skillID, String seqName, String skillName, String npcName, String npcClass)
	{
		super(npcID, skillID, 1);
		this.seqName = seqName;
		this.skillName = skillName;
		this.npcName = npcName;
		this.npcClass = npcClass;
	}

	/**
	 * @return the skill's level
	 */
	@Override
	public final int getSkillLevel()
	{
		return skillLevel;
	}

	/**
	 * @param skillLevel the skill's level to set
	 */
	public final void setSkillLevel(int skillLevel)
	{
		this.skillLevel = skillLevel;
	}

	/**
	 * @return the skill sequence's name
	 */
	public final String getSeqName()
	{
		return seqName;
	}

	/**
	 * @return the skill's name
	 */
	public final String getSkillName()
	{
		return skillName;
	}

	/**
	 * @return the monster's name
	 */
	public final String getNpcName()
	{
		return npcName;
	}

	/**
	 * @return the monster's NPC class
	 */
	public final String getNpcClass()
	{
		return npcClass;
	}

	/* (non-Javadoc)
	 * @see com.l2cdp.entity.IAnalysis#deterministicAnalysis()
	 */
	@Override
	public void deterministicAnalysis()
	{
		int level = -1;
		try
		{
			level = Integer.parseInt(skillName.substring(skillName.length() - 1));
			level = Integer.parseInt(skillName.substring(skillName.length() - 2));
			level = Integer.parseInt(skillName.substring(skillName.length() - 3));
		}
		catch (NumberFormatException nfe)
		{
		}
		if (level < 0)
			level *= -1;
		if (level > 20)
			level /= 10;
		setSkillLevel(level);
	}

	/* (non-Javadoc)
	 * @see com.l2cdp.entity.IAnalysis#experimentalAnalysis()
	 */
	@Override
	public void experimentalAnalysis()
	{ /* Your ideas here */
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString()
	{
		return getNpcName() + "'s skill " + getSkillName();
	}
}
